package com.heisen.system.hander;

import com.heisen.base.entity.Api;
import com.heisen.base.handler.BaseExceptionHandler;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author sen
 * @description  全局异常处理器
 * @date 2023/12/18 11:06
 */
@RestControllerAdvice
public class GlobalExceptionHandler extends BaseExceptionHandler {


    @ExceptionHandler(value = Exception.class)
    public Api handleException(Exception e) {
        System.out.println("系统内部异常");
        return Api.fail("系统内部异常");
    }
}